#coding=utf-8
'''
Created on 2015年7月7日
@author: 403720
'''
import os
import time
import serial
import ConfigParser
import re
#获取公共IP，COM口等公共信息

confipath = r'D:\eclipse\luyouqi\src\common\configuration.txt'

def rounter_IP_connection():
    Conf = ConfigParser.ConfigParser()
    with open(confipath,'r') as file_IP:
        Conf.readfp(file_IP)
        rounterip = Conf.get('rounterIP','testip')
        return rounterip
    
def manchine_IP_connection():
    Conf = ConfigParser.ConfigParser()
    with open(confipath,'r') as file_machine_IP:
        Conf.readfp(file_machine_IP)
        machineip = Conf.get('machine_ip','ip')
        return machineip
    
def GetBaudRate():
    Conf = ConfigParser.ConfigParser()
    with open(confipath,'r') as file_machine_IP:
        Conf.readfp(file_machine_IP)
        BauRate = Conf.get('BaudRate','key')
        return BauRate

def serial_connection():
    Conf = ConfigParser.ConfigParser()
    with open(confipath,'r') as fileserial:
        Conf.readfp(fileserial)
        current_Com = Conf.get('port','testport')
        return current_Com    


def excel_path():
    Conf = ConfigParser.ConfigParser()
    with open(confipath,'r') as path:
        Conf.readfp(path)
        current_path = Conf.get('PATH','path')
        return current_path 
    

def twofour_ssid():                          
    Conf = ConfigParser.ConfigParser()
    with open(confipath,'r') as path:
        Conf.readfp(path)
        current_ssid = Conf.get('SSIDPASSWORD','24gssid')
        return current_ssid
    


def twofour_password():                          
    Conf = ConfigParser.ConfigParser()
    with open(confipath,'r') as path:
        Conf.readfp(path)
        current_password = Conf.get('SSIDPASSWORD','24gpassword')
        return current_password 
     
def PowerOff():
    Conf = ConfigParser.ConfigParser()
    with open(confipath,'r') as file_IP:
        Conf.readfp(file_IP)
        PowerOffCommand = Conf.get('PowerOffCommand','key')
        return PowerOffCommand
    
def PowerOn():
    Conf = ConfigParser.ConfigParser()
    with open(confipath,'r') as file_IP:
        Conf.readfp(file_IP)
        PowerOnCommand = Conf.get('PowerOnCommand','key')
        return PowerOnCommand
    
def GetLogPath():
    Conf = ConfigParser.ConfigParser()
    with open(confipath) as f:
        Conf.readfp(f)
        LogPath = Conf.get('LogPath','Key')
        return LogPath

'''
if __name__=='__main__':
    rounter_IP_connection()               
    serial_connection()                     
    manchine_IP_connection()                
    excel_path()                           
    twofour_ssid()
    twofour_password()
    PowerOff()
    PowerOn()
    GetLogPath()
'''